<?php
/**
 * CreateTime: 2023/7/27 15:50
 */

namespace App\Scopes;

use App\Func\AdminTokenFunc;
use App\Func\TokenFuc;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Scope;

class MediationCompanyAndUpComScope implements Scope
{
    public function apply(Builder $builder, Model $model)
    {
        // 管理端使用 根据公司id过滤
        $adminToken = new AdminTokenFunc();
        $companyId = $adminToken->getUkTInfo()['company_id'];
        $builder->whereIn('company_id', [0,$companyId]);
    }
}